package com.netease.b.b.g;

import com.netease.b.b.e.f;
import com.netease.b.b.e.j;
import com.netease.b.b.e.k;
import com.netease.framework.a.m;
import com.netease.pris.a.i;
import com.netease.pris.c.l;
import java.util.Hashtable;
import java.util.Vector;
import org.json.JSONException;
import org.json.JSONObject;

public class b extends k
{
  private static final String j = "/oauth/request_token";
  private static final String k = "/oauth/authorize";
  private static final String l = "/oauth/access_token";
  private static final String m = "/account/verify_credentials.json";
  private static final int n = 1;
  private static final int o = 2;
  private static final int p = 3;
  private static final int q = 4;
  private static final int z = 5;
  int a = 1;
  String b;

  public b()
  {
    super(4096);
  }

  private j b(String paramString)
  {
    j localj = new j(3);
    try
    {
      JSONObject localJSONObject = new JSONObject(paramString);
      localj.a(com.netease.c.b.c(localJSONObject.optString("id")));
      localj.d(com.netease.c.b.c(localJSONObject.optString("name")));
      localj.e(com.netease.c.b.c(localJSONObject.optString("screen_name")));
      String str = com.netease.c.b.c(localJSONObject.optString("domain"));
      localj.g("http://weibo.com/" + str);
      localj.f(com.netease.c.b.c(localJSONObject.optString("profile_image_url")));
      if (i.e(localj.e()))
        localj.d(localj.f());
      return localj;
    }
    catch (JSONException localJSONException)
    {
      while (true)
      {
        localj = null;
        localJSONException.printStackTrace();
      }
    }
  }

  private m b()
  {
    j localj = new j(3);
    localj.a(1);
    c(0, localj);
    Hashtable localHashtable = new Hashtable();
    String str = c.a().a("/oauth/request_token");
    localHashtable.put("oauth_callback", "prisblog://oauth_callback");
    return c.a().b().a(com.netease.framework.a.b.a, str, localHashtable);
  }

  private m c(String paramString)
  {
    j localj = new j(3);
    localj.a(3);
    c(0, localj);
    Hashtable localHashtable = new Hashtable();
    if (paramString != null)
      localHashtable.put("oauth_verifier", paramString);
    String str = c.a().a("/oauth/access_token");
    return c.a().b().a(com.netease.framework.a.b.a, str, localHashtable);
  }

  private m f()
  {
    StringBuffer localStringBuffer = new StringBuffer(c.a().a("/oauth/authorize"));
    localStringBuffer.append("?");
    localStringBuffer.append("oauth_token");
    localStringBuffer.append("=");
    localStringBuffer.append(c.a().b().d);
    j localj = new j(3);
    localj.getClass();
    localj.a(new d(this, localj, localStringBuffer.toString(), "prisblog://oauth_callback"));
    localj.a(2);
    c(0, localj);
    return null;
  }

  public m a()
  {
    j localj = new j(3);
    localj.a(4);
    c(0, localj);
    String str = c.a().a("/account/verify_credentials.json");
    return c.a().b().a(com.netease.framework.a.b.a, str, null);
  }

  protected void a(int paramInt, Object paramObject)
  {
    super.a(paramInt, paramObject);
    if (this.a != 5)
      g().a(this);
    while (true)
    {
      return;
      h();
    }
  }

  public void a(int paramInt, String paramString)
  {
    f localf = c.a().a(paramInt, paramString);
    d(localf.h, localf);
  }

  public void a(String paramString)
  {
    com.netease.g.b.e("LoninTransaction", paramString);
    switch (this.a)
    {
    case 2:
    default:
      return;
    case 1:
    case 3:
      this.a = (1 + this.a);
    case 4:
    }
    while (true)
    {
      int i;
      try
      {
        Vector localVector = com.netease.c.b.a(paramString, "&");
        i = 0;
        localObject1 = null;
        localObject2 = null;
        if (i >= localVector.size())
          continue;
        String str3 = (String)localVector.elementAt(i);
        if (!str3.startsWith("oauth_token_secret"))
          continue;
        localObject3 = str3.substring(1 + "oauth_token_secret".length());
        localObject4 = localObject2;
        break label365;
        if (!str3.startsWith("oauth_token="))
          break label357;
        String str4 = str3.substring(1 + "oauth_token".length());
        Object localObject5 = localObject1;
        localObject4 = str4;
        localObject3 = localObject5;
        break label365;
        c.a().a((String)localObject2, (String)localObject1);
      }
      catch (Exception localException)
      {
        localException.printStackTrace();
        d(-1, new f(3, -1, null, null));
        this.a = 5;
      }
      break;
      this.a = (1 + this.a);
      j localj = b(paramString);
      if (localj != null)
      {
        com.netease.g.b.e("LoninTransaction", localj.e() + "|" + localj.f() + "|" + localj.h());
        String str1 = c.a().b().d;
        String str2 = c.a().b().e;
        l.a(com.netease.b.a.d.h().a(), localj.e(), 3, str1, str2, localj.g(), localj.h(), localj.b());
        localj.a(5);
        c(0, localj);
        break;
      }
      d(-1, new f(3, -1, null, null));
      break;
      label357: Object localObject3 = localObject1;
      Object localObject4 = localObject2;
      label365: i++;
      Object localObject2 = localObject4;
      Object localObject1 = localObject3;
    }
  }

  public void c()
  {
    com.netease.g.b.e("LoninTransaction", "" + this.a);
    Object localObject = null;
    switch (this.a)
    {
    default:
      if ((o()) || (localObject == null))
        break;
      a(localObject);
    case 1:
    case 2:
    case 3:
    case 4:
    }
    while (true)
    {
      return;
      localObject = b();
      break;
      localObject = f();
      break;
      localObject = c(this.b);
      break;
      localObject = a();
      break;
      if (this.a == 2)
        continue;
      h();
    }
  }
}

/* Location:           D:\android\hack\dex2jar-0.0.9.8\classes_dex2jar.jar
 * Qualified Name:     com.netease.b.b.g.b
 * JD-Core Version:    0.6.0
 */